package omit.wage.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import omit.wage.constant.DeptConstant;
import omit.wage.result.PageResult;
import omit.wage.vo.DeptVO;
import omit.wage.mapper.DepartmentMapper;
import omit.wage.service.IDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author author
 * @since 2024-06-11
 */
@Service
public class DepartmentServiceImpl implements IDepartmentService {
    @Autowired
    private DepartmentMapper departmentMapper;

    public PageResult select(){
        PageHelper.startPage(1, DeptConstant.MAX_VALUE);
        Page<DeptVO> page = departmentMapper.selectAllData();
        long total = page.getTotal();
        List<DeptVO> rows = page.getResult();
        return new PageResult(total, rows);
    }
}
